class Student {
    /**
     * 成员属性 / 成员变量 ： 定义在方法外部，类内部的变量 。
     *
     * 成员变量
     *    1. 静态成员变量
     *    2. 普通成员变量 -》
     */
    public String name;
    public int age;

    public static String classRoom;

    /*public Student() {
    }*/

    /**
     * 静态代码块：
     *   一般用来初始化静态成员
     *   类加载的时候就被调用
     */
    static {
        classRoom = "bit";
        System.out.println("这个是静态代码块！");
    }
    static {
        classRoom = "bit2";
        System.out.println("这个是静态代码块！");
    }
    static {
        classRoom = "bit3";
        System.out.println("这个是静态代码块！");
    }

    {
        this.name = "fsfsa";
        System.out.println("构造代码块！/ 实例代码块！ ");
    }
    {

        System.out.println("构造代码块！/ 实例代码块！ ");
    }

    {

        System.out.println("构造代码块！/ 实例代码块！ ");
    }


    public Student() {
      /*  this.name = "鼠标";
        this.age = 9;
        System.out.println("Student().......");*/
        //调用其他构造方法 -》 只能在构造方法当中写
        this("鼠标",9);
        System.out.println("Student().......");
    }

    //alt + insert  、  鼠标右键  -》 gen.... -》constr.....
    public Student(String name,int age) {
        //this();
        this.name = name;
        this.age = age;
        System.out.println("Student(String,int).......");
    }



    /**
     * 成员方法：
     *    1. 普通成员方法
     *    2. 静态成员方法
     */
    public void eat() {

        System.out.println(this.name + "吃饭！");
    }

    public  void show() {
        //func();
        //this.eat();
        System.out.println("姓名："+this.name +" 年龄："+this.age);
    }

    public static void func() {
        System.out.println("静态的！");
        //System.out.println(this.name + "xxxxx");
    }

    @Override
    public String toString() {
        return "Student{" +
                "姓名 ='" + name + '\'' +
                ", 年龄 =" + age +
                '}';
        /* return "gaobo";*/
    }
}
public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("张三",10);
        student1.show();
        System.out.println("==============");
        System.out.println(student1);

        /* Student student2 = new Student("lisi",4);*/


        //System.out.println(Student.classRoom);

    }

    public static void main4(String[] args) {

       /* Student student1 = new Student("张三",10);

        Student student2 = new Student("lisi",4);

        Student student3 = new Student("wangwu",98);
*/

        //类名访问 就可以了
        System.out.println(Student.classRoom);
        System.out.println(Student.classRoom);
        System.out.println(Student.classRoom);


        Student.func();

    }

    public static void main3(String[] args) {
        /*Student student1 = new Student();
        Student student2 = student1;
*/

        Student student3 = null;
        //student3.show();

/*        student.show();

        Student student2 = new Student("孙悟空",19);
        student2.show();*/

    }

    public static void main2(String[] args) {
        Student student = new Student();

        student.show();

        System.out.println("=============");




        /*int a;
        System.out.println(a);
*/

    }
    public static void main1(String[] args) {
        /**
         * 实例化 对象
         */
        Student student = new Student();
        student.name = "zhangsan";
        student.age = 10;
        student.show();


        System.out.println("=======");
        Student student2 = new Student();
        student2.name = "lisi";
        student2.age = 10;
        student2.show();
    }
}
